/**
  ******************************************************************************
  * @file    ts32fx_hal_tk_bsp.h
  * @author  TOPSYS Application Team
  * @version V1.0.0
  * @date    02-11-2018
  * @brief   This file contains all the touchkey cfg functions.
  ******************************************************************************
  * @attention
  *
  * <h2><center>&copy; COPYRIGHT 2018 TOPSYS</center></h2>
  *
  *
  *
  ******************************************************************************
  */ 
  
/* Define to prevent recursive inclusion -------------------------------------*/
#ifndef __TS32FX_HAL_TK_BSP_H
#define __TS32FX_HAL_TK_BSP_H

#ifdef __cplusplus
 extern "C" {
#endif
     
/* Includes ------------------------------------------------------------------*/
#include "include.h"	 

/****************** via JLINK debug tk **********************************/
#define USE_TK_JLINK_DEBUG        1

/****************** via TOOL debug tk **********************************/
#define USE_TK_TOOL_DEBUG         0

#if USE_TK_TOOL_DEBUG
#define TKDEBUG_GPIOx             GPIOB
#define TKDEBUG_PINx              LL_GPIO_PIN_10
#define TKDEBUG_PIN_SOURCEx       LL_GPIO_PIN_SOURCE_10
#define TKDEBUG_AFx               LL_GPIO_AF_1
#define TKDEBUG_UARTx             UART0
#define TKDEBUG_UARTx_IRQn        UART0_IRQn

//#define TKDEBUG_GPIOx             GPIOC
//#define TKDEBUG_PINx              LL_GPIO_PIN_1
//#define TKDEBUG_PIN_SOURCEx       LL_GPIO_PIN_SOURCE_1
//#define TKDEBUG_AFx               LL_GPIO_AF_0
//#define TKDEBUG_UARTx             UART1
//#define TKDEBUG_UARTx_IRQn        UART1_IRQn

#endif
 
	 
/**
  * @brief  tk gpio initialization function
  * @param  None
  * @retval None
  */
void hal_tk_gpio_init(void);

/**
  * @brief  tk contrl initialization function
  * @param  None
  * @retval None
  */
void hal_tk_ctl_init(void);

/** 
  * @brief  touch key bit map statue 
  * @param  p_tk: The structure pointer of the TK is selected
  * @retval key map state
  */
u32 hal_tk_key_map_get(TK_TypeDef *p_tk);

/** 
  * @brief  TK update base line
  * @param  p_tk: The structure pointer of the TK is selected
  * @retval none
  */
void hal_tk_update_base_line(TK_TypeDef *p_tk);
	 
/*******************************tk software jlink debug function ***************************************/
#if USE_TK_JLINK_DEBUG
/**
  * @brief  TK jlink debug function
  * @param  None
  * @retval None
  */
void hal_tk_jlink_debug_func(void);

/**
  * @brief  TK jlink print tk info
  * @param  key_num 
  * @retval None
  */
void hal_tk_jlink_debug_print_sampval(u32 key_num);
#endif


/******************************tk softwave Tool debug function ***************************************/
#if USE_TK_TOOL_DEBUG
/**
  * @brief  TK tool debug excute function
  * @param  None
  * @retval None
  */
void hal_tk_tool_debug_excute(void);
/**
  * @brief  TK tool debug irq handle function
  * @param  None
  * @retval None
  */
void hal_tk_tool_debug_irq_handle(void);
#endif


#ifdef __cplusplus
}
#endif

#endif //__TS32FX_TK_BSP_H
